package items

import (
	"github.com/hwcer/yyds/context"
)

var handles = map[int32]Handle{}

type Args struct {
	//Id     int32           `json:"id"`     // id 道具ID
	Key    string          `json:"key"`    //道具唯一ID
	Num    int32           `json:"num"`    // num 使用个数
	Attach map[int32]int32 `json:"attach"` // attach 额外参数，如需要选择的 [id]=>num
}
type Handle func(c *context.Context, args *Args, vs ...int32) (any, error)

func Register(t int32, h Handle) {
	handles[t] = h
}

func Require(t int32) Handle {
	return handles[t]
}
